{% extends 'base.html' %}
{% block title %}待办事项{% endblock %}

{% block content %}

  <div id="navigation" class="container-fiuld">
    <nav class="navbar navbar-default navbar-inverse">
      <div class="navbar-header">
        <a class="navbar-brand" href="#"><span class="glyphicon glyphicon-list"> TODO</span></a>
      </div>
    </nav>
  </div>
  {# 添加的表单 #}
  <div id="todo-add" class="container">
    <form action="{{ url_for('add') }}" method="post" class="form-inline float-right">
      <textarea rows="5" cols="50" placeholder="请输入待办事项" name="content" style="margin: 0px; width: 1146px; height: 205px;"></textarea>
      <button type="submit" class="btn btn-success btn-lg"><span class="glyphicon glyphicon-plus"></span></button>
    </form>
  </div>
  <hr>
  {#  列表 #}
  <div id="todo-list">
    <table class="table table-striped">
      <th>
      <td>状态</td>
      <td>内容</td>
      <td>创建时间</td>
      <td>删除</td>
      <td>完成</td>

      </th>
      {% for todo in todo_list %}
        <tr>
          <td>{{ loop.index }}</td>
          {% if todo.status == 0 %}
            <td><span class="glyphicon glyphicon-remove-sign"></span></td>
          {% elif todo.status == 1 %}
            <td><span class="glyphicon glyphicon-thumbs-up"></span></td>
          {% endif %}
          <td>{{ todo.content }}</td>
          <td>{{ todo['create_time'] }}</td>
          <td><a href="{{ url_for('delete',_id=todo._id) }}"><span class="glyphicon glyphicon-remove"></span></a></td>
          <td><a href="{{ url_for('finish',_id=todo._id) }}"><span class="glyphicon glyphicon-ok"></span></a></td>

        </tr>
      {% endfor %}
    </table>
  </div>
{% endblock %}